--TEST--
Check for jsonschema  number validate
--SKIPIF--

<?php if (!extension_loaded("jsonschema"))
    print "skip"; ?>
--FILE--
<?php
/* array Map */
$value = array();
$value['name'] = 'a name';
$value['age'] = 23;
$value['height'] = 183.5;
$jsonSchema = new JsonSchema(json_encode($value));

echo assert(!$jsonSchema->validate('{"type":"object","properties":{"name":{"type":"boolean"},"age":{"type":"integer","default":0,"minimum":20,"maximum":25,"exclusiveMinimum":20,"exclusiveMaximum":25},"height":{"type":"number","default":0,"minimum":0,"maximum":2147483647,"exclusiveMinimum":0,"exclusiveMaximum":2147483647}}}')), PHP_EOL;
echo count($jsonSchema->getErrors()), PHP_EOL;


/* array list */
$value = array();
$value[] = 'str A';
$value[] = 'str B';
$value[] = 'str C';
$jsonSchema = new JsonSchema(json_encode($value));

echo assert(!$jsonSchema->validate('
            {
               "type":"array",
               "items":{
                  "type":"string",
                  "format":"regex","pattern":"/^[a-z0-9]+$/i",
                  "minLength":0,
                  "maxLength":2147483647
               }
            }')), PHP_EOL;
echo count($jsonSchema->getErrors()), PHP_EOL;


/* array List<Map> */
$value = array();
$value['users'][] = array('id' => 1, 'account' => 'userA');
$value['users'][] = array('id' => 3, 'account' => 'userB');
$value['users'][] = array('id' => 5, 'account' => 'userC');
$jsonSchema = new JsonSchema(json_encode($value));

echo assert(!$jsonSchema->validate('{
                               "type":"object",
                               "properties":{
                                  "users":{
                                     "type":"array",
                                     "items":{
                                        "type":"object",
                                        "properties":{
                                           "id":{
                                              "type":"integer",
                                              "default":0,
                                              "minimum":0,
                                              "maximum":2147483647,
                                              "exclusiveMinimum":0,
                                              "exclusiveMaximum":2147483647
                                           },
                                           "account":{
                                              "type":"string",
                                              "minLength":0,
                                              "maxLength":3
                                           }
                                        }
                                     }
                                  }
                               }
                            }')), PHP_EOL;
echo count($jsonSchema->getErrors()), PHP_EOL;



/* array List<Map> */
$value = array();
$value['users'][] = array('id' => 1, 'account' => 'userA');
$value['users'][] = array('id' => 3, 'account' => 'userB');
$value['users'][] = array('id' => 5, 'account' => 'userC');
$jsonSchema = new JsonSchema(json_encode($value));

echo assert($jsonSchema->validate('{
                               "type":"object",
                               "properties":{
                                  "users":{
                                     "type":"array",
                                     "minItems":20,
                                     "maxItems":50,
                                     "items":{
                                        "type":"object",
                                        "properties":{
                                           "id":{
                                              "type":"integer",
                                              "default":0,
                                              "minimum":0,
                                              "maximum":2147483647,
                                              "exclusiveMinimum":0,
                                              "exclusiveMaximum":2147483647
                                           },
                                           "account":{
                                              "type":"string",
                                              "minLength":0,
                                              "maxLength":3
                                           }
                                        }
                                     }
                                  }
                               }
                            }')), PHP_EOL;
echo count($jsonSchema->getErrors()), PHP_EOL;
?>
--EXPECT--
1
1
1
1
1
1
1
1